package controller;

import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;

import javax.swing.JFrame;


public class KeyboardController implements KeyListener{
	JFrame frame;
	
	public KeyboardController(JFrame frame){
		this.frame = frame;
	}
	
	@Override
	public void keyPressed(KeyEvent event) {
		if(event.getKeyCode() == KeyEvent.VK_ESCAPE){
			this.frame.dispose();
			this.frame.setUndecorated(false);
			this.frame.setExtendedState(JFrame.NORMAL);
			this.frame.pack();
			this.frame.setVisible(true);
			frame.requestFocus();
		}
	}

	@Override
	public void keyReleased(KeyEvent event) {}

	@Override
	public void keyTyped(KeyEvent event) {}

}
